package com.job.java.struts;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Map;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;











import com.job.java.struts.common.Action;
import com.job.java.struts.common.ActionMapping;
import com.job.java.struts.common.FormTemp;
import com.job.java.struts.common.StrutsXmlBean;

public class ActionServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	
    public ActionServlet() {
        super();
    }

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("UTF-8");
		response.setCharacterEncoding("UTF-8");
		Map<String, StrutsXmlBean> mapForward = (Map<String, StrutsXmlBean>)this.getServletContext().getAttribute("struts");
		String url = ActionMapping.findForward(request,mapForward);
		response.setContentType("text/html");
		RequestDispatcher requestDispatcher = request.getRequestDispatcher(url);
		requestDispatcher.forward(request, response);
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		this.doGet(request, response);
	}
	
	

}
